//
//  NSStringModel.m
//  ExampleCopy
//
//  Created by 蒋浩源 on 15/10/20.
//  Copyright (c) 2015年 自学教程. All rights reserved.
//

#import "NSStringModel.h"

@interface NSStringModel ()

/**
 *  <#Description#>
 */
@property (nonatomic, strong) NSString *name;

/**
 *  <#Description#>
 */
@property (nonatomic, copy) NSString *mCopyName;

//@property (nonatomic, weak) int age;//weak不可修饰未object-c的对象，只能用assign

@end

@implementation NSStringModel


- (void)printTest
{
    NSLog(@"==========strong==========");
    NSLog(@"》》》》不可变类型的字符串《《《《《");
    NSString *name2 = @"seasun";
    self.name = name2;
    name2 = @"seasun2";
    NSLog(@"self.name:(%p)%@", self.name,self.name);
    Dlog(@"name2", name2);
    
    NSLog(@"》》》》可变类型的字符串《《《《《");
    NSMutableString *mstr2 = [NSMutableString stringWithString:@"mstring"];
    self.name = mstr2;
    mstr2.string = @"更改了";
    NSLog(@"self.name:(%p)%@", self.name,self.name);
    Dlog(@"name2", mstr2);
    
    NSLog(@"\n\t\t\t\t==========copy==========");
    NSLog(@"》》》》不可变类型的字符串《《《《《");
    NSString *name3 = @"seasun";
    self.mCopyName = name3;
    name3 = @"seasun3";
    NSLog(@"self.mCopyName:%@", self.mCopyName);
    Dlog(@"name3", name3);
    
    NSLog(@"》》》》可变类型的字符串《《《《《");
    NSMutableString *mstr3 = [NSMutableString stringWithString:@"mstring"];
    self.mCopyName = mstr3;
    mstr3.string = @"更改了";
    NSLog(@"self.mCopyName:%@", self.mCopyName);
    Dlog(@"name2", mstr3);
}

@end
